// router/index.ts ----------------创建路由------------------
import { createRouter, createWebHistory } from "vue-router";
import { routes } from "./config";
import { message } from "ant-design-vue";
const router = createRouter({
  history: createWebHistory(),
  routes
})
router.beforeEach((to, from, next) => {
  let token = localStorage.getItem('token') || ''
  if (!token && to.name === 'collect') {
    message.warn('请先登录')
    next('/product')
  }
  next()
})
export default router
